package com.yujistu.fragment;

import android.app.Activity;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import com.yujistu.App;
import com.yujistu.view.IBaseFragment;

import butterknife.ButterKnife;

/**
 * Created by S3YOGA on 2015/11/6.
 */
public class BaseItemFragment extends Fragment implements IBaseFragment, View.OnClickListener{

    protected LayoutInflater mInflater;

    protected Activity mActivity;

    public App getApplication(){
        return (App) getActivity().getApplication();
    }

    @Override
    public void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
    }

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
        View view = inflater.inflate(getLayoutId(), container, false);
        ButterKnife.inject(this, view);
        return view;
    }

    @Override
    public void onViewCreated(View view, Bundle savedInstanceState) {
        super.onViewCreated(view, savedInstanceState);
        mActivity = getActivity();
       // initView(view);
    }

    @Override
    public void onResume() {
        super.onResume();
    }

    @Override
    public void onPause() {
        super.onPause();
    }

    @Override
    public void onDestroy() {
        super.onDestroy();
    }

    protected int getLayoutId(){
        return 0;
    }

    protected View inflateView(int resId){
        return this.mInflater.inflate(resId, null);
    }

    public boolean onBackPressed(){
        return false;
    }

    @Override
    public void initView(View view) {

    }
    @Override
    public void initData() {

    }

    @Override
    public void onClick(View v) {

    }
}
